package com.fengye.resign.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fengye.resign.mapper.FileMapper;
import com.fengye.common.domain.entity.Files;
import com.fengye.resign.service.FileService;
import org.springframework.stereotype.Service;

import javax.annotation.Nullable;
import java.util.List;

/**
* @author sunlei
* @description 针对表【fy_file】的数据库操作Service实现
* @createDate 2024-05-27 17:01:39
*/
@Service
public class FileServiceImpl extends ServiceImpl<FileMapper, Files>
    implements FileService {
    /**
     * 根据MD5查询文件
     * @param md5 md5
     * @return 文件
     */
    @Override
    @Nullable
    public Files getFileByMd5(String md5) {
        LambdaQueryWrapper<Files> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Files::getMd5, md5);
        List<Files> list = this.list(queryWrapper);
        return list.size() == 0 ? null : list.get(0);
    }
}




